﻿using System;

namespace TextEditor
{
    

    public class A_PageViewMode : A_Action
    {
        public override string ActionName()
        {
            return "pageviewmode";
        }

        public override int CheckState()
        {
            if (base.myOwnerDocument.OwnerControl != null)
            {
                return (base.myOwnerDocument.OwnerControl.PageViewMode ? 1 : 0);
            }
            return -1;
        }

        public override bool Execute()
        {
            if (base.myOwnerDocument.OwnerControl != null)
            {
                bool flag = base.Param1 == "1";
                base.myOwnerDocument.OwnerControl.PageViewMode = true;//flag
                base.myOwnerDocument.RefreshLine();
                if (flag)
                {
                    base.myOwnerDocument.OwnerControl.RefreshPages();
                }
                else
                {
                    base.myOwnerDocument.UpdateView();
                }
                base.myOwnerDocument.Refresh();
                base.myOwnerDocument.OwnerControl.ShowSmartTag(false);
                base.myOwnerDocument.OwnerControl.UpdateTextCaret();
            }
            return true;
        }
    }
}

